#include  <cstdio>
#include  <cstring>
#include  <iostream>
using namespace std;

int main(int argc, char *argv[])
{
	char s[11],pre[11];
	scanf("%s",pre);
	printf("%s\n",pre);
	int pren = 0, sum = 0,len,lenp = strlen(pre);
	while( scanf("%s",s) != EOF )
	{
		sum = 0;
		len = strlen(s);
		for( int i = 0, j = 0; i < lenp && j < len  ; ++i,++j )
		{
			if(s[i] == pre[j])
				sum++;
			else break;
		}
		lenp = len;
		if( sum == 0 )
		{
			printf("%s\n",s);
			strcpy(pre,s);
			pren = 0;
		} else
		{
			pren = sum > pren ? pren + 1 : sum;
			//cout << pren << " " << sum  << endl;
			strcpy(pre,s);
			int temp = pren;
			while(temp--) printf(" ");
			printf("%s\n",s);
		}
		
	}
}
